/* 
 * The base class, all its subclasses should implement <code>operator ()</code> to handle the syscalls of the source
 * binary code.
 */
#ifndef SIGNALHANDLER_H
#define SIGNALHANDLER_H

#include "crossbit/common.h"
#include "crossbit/MemoryImage.h"
#include "crossbit/MemoryManager.h"
#include "crossbit/TraceManager.h"
#include "crossbit/Interpreter.h"
#include "crossbit/Translator.h"
#include "crossbit/TBlock.h"
#include "crossbit/TCache.h"
#include "crossbit/VBlockBuilder.h"
#include "crossbit/VFilter.h"
#include "crossbit/SyscallHandler.h"
#include "crossbit/ProcessorState.h"
#include "crossbit/SignalRegister.h"
#include <signal.h>


namespace crossbit {

    class ProcessorState;
    class MemoryImage;
    class SignalRegister;

    class SignalHandler
    {
        public:
            SignalHandler(ProcessorState	*processor_state,
						  MemoryImage		*memory_image, 
                          MemoryManager		*memory_manager,
						  TraceManager		*trace_manager,
                          Interpreter		*interpreter, 
                          VBlockBuilder 	*builder, 
                          TCache 			*tcache,
                          Translator 		*translator,
                          SyscallHandler	*syscall_handler,
						  SignalRegister	*signal_register);

            virtual ~SignalHandler() {}

        protected:
            // a pointer to the source binary code's simulated process state
            static ProcessorState	*sig_state; //
            // a pointer to the source binary image
            static MemoryImage		*sig_img;
			static MemoryManager	*sig_mm;
			static TraceManager		*sig_tm; //
			static Interpreter		*sig_itp;//
			static VBlockBuilder 	*sig_vbb;//
			static TCache 			*sig_tc; //
			static Translator 		*sig_tr; //
			static SyscallHandler	*sig_sh; //
			static SignalRegister	*sig_rg; //

		private:
			SignalHandler& operator=(SignalHandler&);
			SignalHandler(SignalHandler&);
    };
}
#endif
